<template>
  <div style="margin: 10px">
    <div class="pic-box">
      <enlarge-goods :url="pImgSrc" :scale="3"></enlarge-goods>
    </div>
    <div class="box">
      <el-carousel height="96px" indicator-position="none" :interval="0">
        <el-carousel-item v-for="(item,i) in imagesList" :key="i">
          <div
            v-for="(img,index) in item"
            :key="index"
            @click="getIndex(img.url)"
            class="img-url"
          >
            <img :src="img.url" />
          </div>
        </el-carousel-item>
      </el-carousel>
    </div>
  </div>
</template>


<script>
  import BaseVue from '../../components/BaseVue'
  import EnlargeGoods from "../../components/common/EnlargeGoods";
  export default {
    name: 'ShopDetailsLeftExhibition',
    extends:BaseVue,
    components: {
      EnlargeGoods
    },
    data() {
      return {
        pImgSrc: ""
      };
    },
    props: {
      imgSrc: {
        type: String,
        default: ""
      },
      imagesList: {
        type: Array,
        default: function() {
          return [];
        }
      }
    },
    methods: {
      getIndex(imgSrc) {
        this.pImgSrc = imgSrc;
      }
    },
    watch: {
      imgSrc: {
        handler(aImgSrc, pImgSrc) {
          this.pImgSrc = aImgSrc;
        },
        immediate: true
      },
    }
  }
</script>

<style lang="scss" scoped>
  .box {
    width: 500px;
    height: 100px;
    overflow: hidden;
    margin-top: 10px;
    ul {
      position: absolute;
      width: 2000px;

      li {
        display: inline-block;
        list-style: none;
        width: 90px;
        height: 90px;
        background-color: white;
        margin-top: 15px;
        border: 1px solid #eee;
        overflow: hidden;
        margin-right: 10px;
        img {
          width: 100%;
        }
      }
    }
  }
  .pic-box {
    position:relative;
    width: 498px;
    height: 498px;
    border: 1px solid #eee;
  }
  /deep/ .mouse-cover-canvas {
    top: 200px !important;
    margin-top: 200px;
  }

  .img-url {
    display: inline-block;
    border: 1px solid #eee;
    margin-right: 10px;
    &:nth-child(5) {
      margin-right: 0;
    }
    img {
      width: 90px;
    }
  }
</style>
